<extend name="./public/frame.html"/>
<block name="content">
    <div class="layer_content">
        <div class="layer_form">
            <div class="down_icon"></div>
            <div class="layer_div">
                <div class="layer_tit">
                    手机号码：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="phone" placeholder="手机号码">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    开通时间：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="startTime" placeholder="开通会员时间">
                </div>
            </div>
            <div class="layer_div">
                <div class="layer_tit">
                    开通时间：
                </div>
                <div class="layer_control">
                    <input type="text" class="w180" id="endTime" placeholder="开通会员时间">
                </div>
            </div>
            <div class="button_search">
                <button class="layui-btn" data-type="search" style="float:right;margin-right: 53px;">搜索</button>
            </div>
        </div>
    </div>
    <table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('MemberRecharge/index')}', page: true, limit: 10, id:'MemberRecharge'}" lay-filter="MemberRecharge">
        <thead>
        <tr>
            <th lay-data="{field:'id', width:80,align:'center', fixed: true, sort: true}">ID</th>
            <th lay-data="{field:'uid', width:100,align:'center'}">会员UID</th>
            <th lay-data="{field:'user_phone', width:150,align:'center'}">手机号</th>
            <th lay-data="{field:'typeName', width:220,align:'center'}">类型</th>
            <th lay-data="{field:'orderTypeName', width:100,align:'center'}">订单类型</th>
            <th lay-data="{field:'order_sn', width:200,align:'center'}">订单号</th>
            <th lay-data="{field:'order_money', width:100,align:'center'}">订单金额</th>
            <th lay-data="{field:'ratio', width:100,align:'center'}">比例(%)</th>
            <th lay-data="{field:'money', width:200,align:'center'}">金额</th>
            <th lay-data="{fixed:'right',field:'add_time', width:200,align:'center'}">时间</th>
        </tr>
        </thead>
    </table>
    <script>
        layui.use(['table','laydate'], function () {
            var table = layui.table,laydate = layui.laydate;
            //常规用法
            laydate.render({
                elem: '#startTime'
                ,theme: '#393D49'
                ,type: 'datetime'
            });
            laydate.render({
                elem: '#endTime'
                ,theme: '#393D49'
                ,type: 'datetime'
            });
            //搜索
            $('.layui-btn').on('click', function () {
                var phone = $("#phone").val();
                var startTime = $("#startTime").val();
                var endTime = $("#endTime").val();
                if(endTime != '' && startTime > endTime){
                    layer.msg('开始时间不能大于结束时间',{icon: 5});return false;
                }
                table.reload('MemberRecharge', {
                    url: '/admin/MemberRecharge/index', where: {
                        "phone": phone,
                        "startTime": startTime,
                        "endTime": endTime
                    }
                });
            })
        });

    </script>
</block>
